using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using XFGameFramework;

public class 怒叨 : TakeDamageBase
{
    public int theSkillId = 10002;
    private Module module = ModuleManager.GetModule("MainModule");
    private SkillConfig SkillConfig => XFABManager.AssetBundleManager.LoadAsset<SkillConfig>(module.ModuleName, "SkillConfig");
    private PlayerController playerController => module.LoadController<PlayerController>();
    private SkillController skillController => module.LoadController<SkillController>();
    private EnemyController enemyController => module.LoadController<EnemyController>();
    public 怒叨(RolesModel creator, RolesModel target, int outskillId) : base(creator, target, outskillId)
    {

    }
    public override void ApplyAction()
    {
        base.ApplyAction();
        if (target == null)
        {
            Debug.LogError("没有目标");
        }
        if (creator == null)
        {
            Debug.LogError("没有创建者");
        }
        List<int> skillList = skillController.GetSkillList(creator);
        
        foreach (int skillId in skillList)
        {
            if (skillId == theSkillId)
            {
                skillController.skillCDUP(creator, skillId, SkillConfig.GetSkillInfo(skillId).cooling_rounds);
                break;          
            }
        }

        怒叨 怒叨 = new 怒叨(creator, target, theSkillId);
        //将距离设置为一
        FightInfo.Instance.Distance = 1;
        怒叨.ComputeDamage();
        Debug.Log("怒叨技能释放");
        isFrozen();
    }
    public override int CalculateDamage(int baseDamage, RolesModel target)
    {
        int finalDamage = enemyController.CurrentAgility;
        return finalDamage;
    }
    private void isFrozen()
    {
        if (Utility.属性鉴定(enemyController.CurrentAgility, playerController.CurrentStrength))
        {
            //TODO 冰冻效果
        }
    }
}

